require "./store"
require "hashids"

class Gen

  @@hashids = Hashids.new
  def self.run()
    num = 0
    base = 10000000000
    loop do
      num += 1
      key = @@hashids.encode([base + num])
      Store.save(key, "1")
      puts "#{key} == #{num}"
      break if num == 1000
    end
  end

  def self.gen()
    num = 0
    loop do
      num += 1
      code = "%06d" % Random.new.rand(0..1000000)
      Store.save(code, "1")
      puts code
      break if num == 1000
    end
  end

end

# Gen.gen
# puts Store.get "958400"

# Gen.run

# key = Hashids.new.encode([10000000002])
# puts key

# Store.save("1","1")
# puts Store.get("1")

# puts Hashids.new.encode([10000000000 + 1])
